#-------------------------------------------------------------------------------
# Name:        ChangeStartTime
# Purpose:     Access a route Network Analyst layer, and change when the route
#              will depart from the first stop.
#
# Author:      Esri
#
# Created:     16/12/2011
# Copyright:   (c) Esri 2011
#-------------------------------------------------------------------------------

import arcpy
from datetime import datetime

def main():
    arcpy.env.overwriteOutput = True

    #Get the Network Analyst layer object and the date/time value from the
    # user interface.
    naLayer = arcpy.GetParameter(0)
    datehour = arcpy.GetParameter(1)

    #Set the route start time and date to match that entered by the user.
    routeProps = arcpy.na.GetSolverProperties(naLayer)
    routeProps.timeOfDay = datehour

    #Return the updated Network Analyst layer.
    arcpy.SetParameter(2, naLayer)

if __name__ == '__main__':
    main()
